package com.zte.cl.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

@Entity
@Table(name = "t_news")
public class News {

	private String id;
	private String channelId;
	private String title;
	private String subtitle;
	private String thumbnail;
	private String author;
	private String keyword;
	private String source;
	private Integer hits;
	private String content;
	private Boolean isEnabled;
	private String pageId;
	private String pageUrl;
	private String flag;
	private String deptId;
	private Date publishTime;
	private Date insertTime;
	
	/**
     * 内容页面抓取失败次数
     */
    private int failNum=0;

	@Id
	@Column(length = 32)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "channel_id", length = 2)
	public String getChannelId() {
		return channelId;
	}

	public void setChannelId(String channelId) {
		this.channelId = channelId;
	}

	@Column(length = 120)
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "subtitle", length = 512)
	public String getSubtitle() {
		return subtitle;
	}

	public void setSubtitle(String subtitle) {
		this.subtitle = subtitle;
	}

	@Column(name = "thumbnail", length = 256)
	public String getThumbnail() {
		return thumbnail;
	}

	public void setThumbnail(String thumbnail) {
		this.thumbnail = thumbnail;
	}

	@Column(name = "author", length = 64)
	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	@Column(name = "keyword", length = 64)
	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	@Column(name = "source", length = 32)
	public String getSource() {
		return source;
	}

	public void setSource(String source) {
		this.source = source;
	}

	@Column(name = "hits", length = 11)
	public Integer getHits() {
		return hits;
	}

	public void setHits(Integer hits) {
		this.hits = hits;
	}

	@Column(name = "content")
	@Lob
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "is_enabled", columnDefinition = "tinyint")
	public Boolean getIsEnabled() {
		return isEnabled;
	}

	public void setIsEnabled(Boolean isEnabled) {
		this.isEnabled = isEnabled;
	}

	@Column(name = "page_id", length = 32)
	public String getPageId() {
		return pageId;
	}

	public void setPageId(String pageId) {
		this.pageId = pageId;
	}

	@Column(name = "page_url", length = 255)
	public String getPageUrl() {
		return pageUrl;
	}

	public void setPageUrl(String pageUrl) {
		this.pageUrl = pageUrl;
	}

	@Column(name = "flag", length = 1, columnDefinition = "char")
	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	@Column(name = "dept_id", length = 32)
	public String getDeptId() {
		return deptId;
	}

	public void setDeptId(String deptId) {
		this.deptId = deptId;
	}

	@Column(name = "publish_time")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getPublishTime() {
		return publishTime;
	}

	public void setPublishTime(Date publishTime) {
		this.publishTime = publishTime;
	}

	@Column(name = "insert_time")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getInsertTime() {
		return insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}
	
	@Transient
	public int getFailNum() {
		return failNum;
	}

	public void setFailNum(int failNum) {
		this.failNum = failNum;
	}

	@Override
	public String toString() {
		return "News [id=" + id + ", channelId=" + channelId + ", title="
				+ title + ", subtitle=" + subtitle + ", thumbnail=" + thumbnail
				+ ", author=" + author + ", keyword=" + keyword + ", source="
				+ source + ", hits=" + hits + ", content=" + content
				+ ", isEnabled=" + isEnabled + ", pageId=" + pageId
				+ ", pageUrl=" + pageUrl + ", flag=" + flag + ", deptId="
				+ deptId + ", publishTime=" + publishTime + ", insertTime="
				+ insertTime + ", failNum=" + failNum + "]";
	}

}
